Imports System.Windows.Forms

Public Class frmInformation

    Sub New(ByVal Title As String, ByVal Msg As String, Optional ByVal ExtraMsg As String = "", Optional ByVal Style As Microsoft.VisualBasic.MsgBoxStyle = MsgBoxStyle.OkOnly)
        MyBase.New()
        Me.InitializeComponent()

        If Style And MsgBoxStyle.Exclamation Then
            If Style = MsgBoxStyle.Exclamation Then
                Me.btnOk.Visible = True
            End If
            Me.uxImg.Image = Me.uxImgList.Images(0)
        End If
        If Style And MsgBoxStyle.Critical Then
            If Style = MsgBoxStyle.Critical Then
                Me.btnOk.Visible = True
            End If
            Me.uxImg.Image = Me.uxImgList.Images(1)
        End If
        If Style And MsgBoxStyle.Information Then
            If Style = MsgBoxStyle.Information Then
                Me.btnOk.Visible = True
            End If
            Me.uxImg.Image = Me.uxImgList.Images(2)
        End If
        If Style And MsgBoxStyle.Question Then
            If Style = MsgBoxStyle.Question Then
                Me.btnOk.Visible = True
            End If
            Me.uxImg.Image = Me.uxImgList.Images(3)
        End If

        Me.Text = Title

        Me.uxlbMsg.Text = Msg

        If ExtraMsg = "" Then
            Me.uxlblExtraMsg.Visible = False
        Else
            Me.uxlblExtraMsg.Visible = True
            Me.uxlblExtraMsg.Text = ExtraMsg
        End If

        If Style And MsgBoxStyle.Critical Then
            Me.btnExit.Visible = True
            Exit Sub
        End If

        If Style And MsgBoxStyle.OkCancel Then
            Me.btnCancel.Visible = True
            Me.btnOk.Visible = True
        End If

        If Style And MsgBoxStyle.YesNo Then
            Me.btnYes.Visible = True
            Me.btnNo.Visible = True
        End If

        If Style = 0 Then
            Me.btnOk.Visible = True
        End If

    End Sub


    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub btnYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYes.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Yes
        Me.Close()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        End
    End Sub

    Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.No
        Me.Close()
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub
End Class
